package cn.me.implement.threadpool.v3_1.reject;

import cn.me.implement.threadpool.v3_1.ThreadPool3_1;

/**
 * <h3>丢弃队列中最旧的任务，重新提交任务的拒绝策略</h3>
 */
public class DiscardOldestPolicy implements RejectPolicy {

    @Override
    public void reject(ThreadPool3_1 threadPool, Runnable task) {
        threadPool.discardOldestTask();
        threadPool.submit(task);
    }
}
